home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / VCal / TimeGrid.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.2 KB  |  99 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #ifndef _TIME_GRID_
  18. #define _TIME_GRID_
  19.  
  20. #include <Vk/VkComponent.h>
  21.  
  22. typedef enum TimeGridReason { TG_none, TG_deselect, TG_requestNew };
  23.  
  24. typedef struct {
  25.   TimeGridReason reason;
  26.   int value;
  27.   void *data;
  28. } TimeGridCallback;
  29.  
  30. typedef struct {
  31. Widget timeLabel;
  32. Widget separator;
  33. } AreaInfo;
  34.  
  35. class TimeEntryText;
  36.  
  37. class TimeGrid : public VkComponent {
  38. public:
  39.   TimeGrid(const char *name, Widget parent,
  40.        Boolean editable = True,
  41.        int timeInterval = 60, int subdivisions = 4,
  42.        int start = 0, int length = 24*60);
  43.   ~TimeGrid();
  44.  
  45.   virtual const char *className();
  46.  
  47.   void setCallback(XtCallbackProc proc, XtPointer client_data);
  48.   void changeDuration(int start, int length);
  49.   int getStart() { return _start; }
  50.   int getLength() { return _length; }
  51.   Boolean requestPosition(int start, int length,
  52.               Position *x_return, Position *y_return,
  53.               Dimension *width_return, Dimension *height_return);
  54.   Boolean requestWeekdayPosition(int start, int length, int weekday,
  55.                  Position *x_return, Position *y_return,
  56.                  Dimension *width_return,
  57.                  Dimension *height_return);
  58.   Boolean requestIntervalPosition(int start, int length,
  59.                   Position *x_return, Position *y_return,
  60.                   Dimension *width_return,
  61.                   Dimension *height_return);
  62.   void requestInterval(Position y, Dimension height,
  63.                int *start_return, int *length_return);
  64.  
  65.   Widget getParent() { return _baseWidget; }
  66.   TimeEntryText *getText() { return _text; }
  67.   XmFontList getTextFontList() { return _textFontList; }
  68.   Dimension getSlotHeight() { return _slotHeight; }
  69.   Dimension getSubDiv() { return _subdiv; }
  70.   Dimension getHeight() { return _numTime*_subdiv*_slotHeight+2*_horizSepHeight; }
  71.   void reconfig(Boolean always = False);
  72.   void reset();
  73.   void hideCurrentTime();
  74.   void showCurrentTime(int start);
  75.  
  76. protected:
  77.   void createAreas(Widget parent);
  78.   void destroyAreas();
  79.   void callCallback(TimeGridReason reason, int value = 0, void *data = NULL);
  80.   void buttonPress(XEvent *event);
  81.  
  82.   static void reconfig_stub(Widget w, XtPointer client_data, XEvent *event,
  83.                 Boolean *dispatch);
  84.   static void button_press(Widget w, XtPointer client_data, XEvent *event,
  85.                Boolean *dispatch);
  86.  
  87.   Widget _left, _right, _bottom, _currentTime;
  88.   int _numTime, _start, _length, _timeInt, _subdiv, _slotHeight;
  89.   AreaInfo *_areas;
  90.   Dimension _marginWidth, _spacing, _horizSepHeight;
  91.   Dimension _width, _height, _leftW, _rightW, _sepH, _maxWidth;
  92.   TimeEntryText *_text;
  93.   XmFontList _textFontList;
  94.   XtCallbackProc _callback;
  95.   XtPointer _callbackData;
  96. };
  97.  
  98. #endif
  99.